<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>留言板</title>
<link rel="stylesheet" type="text/css" href="<{$css}>bootstrap.min.css"/>
<link rel="stylesheet" type="text/css" href="<{$css}>style.css"/>
<script language="javascript" src="<{$script}>jquery-1.7.js"></script>
<script language="javascript" src="<{$script}>bootstrap.min.js"></script>
<script language="javascript" >
$(function(){
	var _error       = new Array(),
	    _password    = $('#password'),
	    _qr_password = $('#qr-password'),
	    _code        = $('#code');
	$('#regname').blur(function(){
			var username = $(this).val();
			$.get('__URL__/checkName',{'username':username},function(rsdata){
				if(rsdata.status==1){//用户已存在
					_error['username'] = 1;
					$('#usernameError').removeClass('hidden');	
					$('#usernameOk').addClass('hidden');	
				}else{//可以注册
				    _error['username'] = 0;
				  	$('#usernameOk').removeClass('hidden');	
					$('#usernameError').addClass('hidden');	
				}
				})
		})
	_password.blur(function(){
	if($(this).val()==''){
					_error['password']=1;
					$('#passwordError').removeClass('hidden');	
					$('#passwordOk').addClass('hidden');	
		}else{
					$('#passwordError').addClass('hidden');	
					$('#passwordOk').removeClass('hidden');	
					
			}
	});
	_qr_password.blur(function(){
	if($(this).val()=='' || $(this).val()!=_password.val()){
					_error['qr-password']=1;
					$('#qr-passwordError').removeClass('hidden');	
					$('#qr-passwordOk').addClass('hidden');	
		}else{
					_error['qr-password']=0;
					$('#qr-passwordOk').removeClass('hidden');	
					$('#qr-passwordError').addClass('hidden');	
			}
	});

		$("form[name = regform]").submit(function(){
			if(_error['username']==1||_error['password']==1||_error['qr-password']==1){
				return false;
			}else{
				return true;	
			}
			})
	})
</script>
</head>
<body>

<form action="__URL__/doReg" method="post" name="regform"  >
<table border="0" cellpadding="0" cellspacing="0" class="load" style="width:600px;">
  <tr>
   <td width="100" height="46" align="right">用户名：</td>
   <td width="400"><input type="text" name="username"  class="form-control" id="regname"/></td>
   <td width="100">
   <span id="usernameOk" class="hidden text-success"><span class="glyphicon glyphicon-ok"></span></span>
   <span id="usernameError" class="hidden text-danger">该用户名已被注册</span>
   </td>
  </tr>
  <tr>
   <td width="80" height="46" align="right">密码：</td>
   <td><input type="password" name="password"  class="form-control" id="password"/></td>
   <td width="100">
   <span id="passwordOk" class="hidden text-success"><span class="glyphicon glyphicon-ok"></span></span>
   <span id="passwordError" class="hidden text-danger">密码不能为空</span>
   </td>
  </tr>
  <tr>
   <td width="80" height="46" align="right">确认密码：</td>
   <td><input type="password" name="qr-password"  class="form-control" id="qr-password"/></td>
   <td width="100">
   <span id="qr-passwordOk" class="hidden text-success"><span class="glyphicon glyphicon-ok"></span></span>
   <span id="qr-passwordError" class="hidden text-danger">密码不一致</span>
   </td>
  </tr>
  <tr>
   <td width="80" height="46" align="right">性别：</td>
   <td>
   <div class="radio-inline">
  <label>
    <input type="radio" name="sexy" value="1" checked="checked"/> 男 
  </label>
  </div>
  <div class="radio-inline">
  <label>
    <input type="radio" name="sexy" value="0"/> 女 
  </label>
  </div>
</td>
  </tr>
  <tr>
   <td width="80" height="46" align="right">验证码：</td>
   <td><div class="row"><span class="col-xs-6"><input type="text" name="code" class="form-control" id="code"/></span><span class="col-xs-6"><img src='__APP__/Base/verify/' onclick="this.src = this.src + '?'+ Math.random()"/></span></div></td>
   <td width="100">
   <span id="codeOk" class="hidden text-success"><span class="glyphicon glyphicon-ok"></span></span>
   <span id="codeError" class="hidden text-danger">验证码不正确</span>
   </td>   
  </tr>
  <tr>
   <td width="80" height="46" ></td>
   <td><input type="submit" name="submit" value="注册" class="btn btn-default"/>&nbsp;&nbsp;&nbsp;&nbsp;<a href="__APP__/Register/index">登陆</a></td>
   <td  ><{$regError}></td>
  </tr>
 </table>
  </form>

 </body></html>